<template>
  <!-- 文档下载 -->
  <div class="Documentdownload">
    <!-- 筛选框 -->
    <div class="incolumn_countr">
      <div class="search-box">
        <hy-search
          ref="query"
          :searchTitle="searchTitle"
          v-model="searcher"
          :button="{btnShowBy3:true}"
          :buttonText="{btnNameBy3:'新增合同'}"
          :col="6"
          @search="getData(0)"
          @clickbybtn3="clickBy3"
        ></hy-search>
      </div>
    </div>
    <!-- end -->
    <div class="table-box">
      <template>
        <el-table :data="tableData" style="width: 100%;" stripe :height=" 600 ">
          <el-table-column fixed type="index" label="序号" width="100" align="center"></el-table-column>
          <el-table-column fixed prop="createOnStr" label="创建时间" align="center"></el-table-column>
          <el-table-column prop="comapny" label="合作企业" align="center"></el-table-column>
          <el-table-column prop="projectName" label="合作项目" align="center"></el-table-column>
          <el-table-column prop="price" label="金额" align="center"></el-table-column>
          <el-table-column prop="address" label="存放地址" align="center"></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button type="warning" size="mini" @click="xiangq(scope.row.id,0)">编辑</el-button>
              <el-button type="primary" size="mini" @click="xiangq(scope.row.id,1)">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <template>
      <el-pagination
        background
        layout="prev, pager, next"
        :total="total"
        style="text-align:center;margin-top:15px;"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
      ></el-pagination>
    </template>
  </div>
  <!-- </div> -->
</template>

<script>
import axios from "axios";
export default {
  computed: {},
  data () {
    return {
      searchTitle: [
        {
          xuhao: "1",
          type: "input",
          name: "customProductName",
          label: "输入搜索",
          placeholder: "请输入公告主题",
          prop: "customProductName"
        },

        {
          type: "date2",
          name: "issuanceDate",
          label: "输入时间",
          placeholder: "请选择输入时间",
          prop: "issuanceDate"
        }
      ],
      searcher: {
        customProductName: "",
        customProductNo: "",
        issuanceDate: ""
      },
      tableData: [],
      total: 1,
      current: 1,
      pagesize: 11
    };
  },
  created () {
    this.creater = JSON.parse(localStorage.getItem("message")).Id;
    this.getwageslist();
  },
  methods: {
    // 分页
    handleCurrentChange (e) {
      this.getwageslist(e - 1);
    },
    //详情
    xiangq (e, shows) {
      this.$router.push({ path: "./FileAdd", query: { e: e, shows: shows } });
    },
    clickBy3 (e, shows) {
      this.$router.push({ path: "./FileAdd", query: { e: 0, shows: 0 } });
    },
    //列表数据
    getwageslist (page) {
      let start = ""; let end = "";
      if (this.searcher.issuanceDate != null && this.searcher.issuanceDate != "") { start = this.searcher.issuanceDate[0]; end = this.searcher.issuanceDate[1]; }
      let obj = {
        creater: this.creater,
        key: this.searcher.customProductName ? this.searcher.customProductName : "",
        start: start,
        end: end,
        pn: page,
        PerPageSize: this.pagesize,
        type: 1
      };
      var objs = JSON.stringify(obj);
      let the = { index: 24, jsondata: objs }
      // console.log(objs);
      axios.post("/apis/MyCenter.asmx/GetData", the).then(({ data }) => {
        var list = eval('(' + data.d + ')');
        // console.log(list);
        this.total = list.count;
        this.tableData = list.data;
      });
    }
  }
};
</script>

<style lang="scss" scoped>
@import '@/assets/scss/base.scss';
.incolumn_countr {
  width: 97%;
}
.table-box {
  width: 98%;
  margin-left: 15px;
}
.el-pagination {
  margin-top: 15px;
  text-align: center;
}
</style>